<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=`, initial-scale=1.0">
    <title>Document</title>
  </head>

  <style>
    .item {
      background-color: gray;
      /* 渲染第二步：样式计算 */
      width: 50%;
      margin: 0 auto;
      /* height: 50vh; */
      /* aspect-ratio的兼容问题 (Edge 88, Firefox 89, Safari 15, Chrome 88, Opera 74) */
      /* aspect-ratio: 16/9; */
    }

    .inner {
      width: 100%;
      /* 渲染第三步：视觉格式化模型 */
      height: 0;
      padding-top: 75%;
      position: relative;
    }

    .container {
      position: absolute;
      inset: 0;
      background: red;
    }
  </style>

<body>
  <div class="item">
    <div class="inner">
      <div class="container"></div>
    </div>
  </div>
</body>

</html>